#include "memberclass.h"
#include "global.h"

QList<MemberClass*> MEMBERLIST;

MemberClass::MemberClass()
{
    sName = "";
    teacherName = "";
    iAbilityLevelIndex = 0;
//    iAbilityValueIndex = 0;
//    iNightCountIndex = 0;
    iRequirementIndex = 0;
//    iAbilityValue = 0;
    dayCount = 0;
    nightCount = 0;
    workCount = 0;
    specicalNightWorkCount = 0 ;
    dayVec.clear();
    nightVec.clear();
}

void MemberClass::setMemberName(QString name)
{
    sName = name;
    return;
}

QString MemberClass::getMemberName(void) const
{
    return sName;
}

void MemberClass::setMemberAbilityLevelIndex(int level)
{
    iAbilityLevelIndex = level;
    return;
}

int MemberClass::getMemberAbilityLevelIndex(void)
{
    return iAbilityLevelIndex;
}

void MemberClass::setMemberRequirementIndex(int index)
{
    iRequirementIndex = index;
    return;
}

int MemberClass::getMemberRequirementIndex(void)
{
    return iRequirementIndex;
}

const QString &MemberClass::getTeacherName() const
{
    return teacherName;
}

void MemberClass::setTeacherName(const QString &newTeacherName)
{
    teacherName = newTeacherName;
}

MemberClass &MemberClass::operator =(const MemberClass &newObj)
{
    sName = newObj.getMemberName();
    teacherName = newObj.getTeacherName();
    iAbilityLevelIndex = newObj.iAbilityLevelIndex;
    iRequirementIndex = newObj.iRequirementIndex;
    dayCount = newObj.dayCount;
    nightCount = newObj.nightCount;

    return *this;
}

const QVector<int> &MemberClass::getNightVec() const
{
    return nightVec;
}

void MemberClass::setNightVec(const QVector<int> &newNightVec)
{
    nightVec = newNightVec;
}

const QVector<int> &MemberClass::getDayVec() const
{
    return dayVec;
}

void MemberClass::setDayVec(const QVector<int> &newDayVec)
{
    dayVec = newDayVec;
}

// DATESET_DAYWORK          dayVec
// DATESET_NIGHTWORK        nightVec
void MemberClass::vectorAppend(int type, const int value)
{
    if( DATESET_DAYWORK == type)
        dayVec.append(value);
    else
        nightVec.append(value);;
    return;
}

int MemberClass::getDayCount() const
{
    return dayCount;
}

void MemberClass::setDayCount(int newDayCount)
{
    dayCount = newDayCount;
    workCount = dayCount + nightCount * 2;
}

int MemberClass::getNightCount() const
{
    return nightCount;
}

void MemberClass::setNightCount(int newNightCount)
{
    nightCount = newNightCount;
    workCount = dayCount + nightCount * 2;
}

void MemberClass::workCountPlus(int type, int num)
{
    if( DATESET_DAYWORK == type)
        dayCount += num;
    else
        nightCount += num;
    workCount = dayCount + nightCount * 2;
    return;
}

int MemberClass::getWorkCount() const
{
    return workCount;
}

void MemberClass::setWorkCount(int newWorkCount)
{
    workCount = newWorkCount;
}

int MemberClass::getLackDayCount(int count)
{
    lackDayCount = count - workCount;
    return lackDayCount;
}

